<template>
 <view>
        <view class="cu-card dynamic" v-for="(item,index) in productList" :key="index">
            <view class="cu-item shadow">
                <view class="cu-list menu-avatar">
                    <view class="cu-item">
						<view class="cu-avatar round lg">
							<image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar round lg" mode="widthFix">
						</view>
                        <view class="content flex-sub">
							<view class="text-content">
								{{item.noticeTitle}}
							</view>
                        </view>
                    </view>
                </view>
                <view class="text-content" style=" text-align: center;">
					 <text>公告内容</text>
                  <!-- <text> 公告内容： {{item.noticeContent}}</text> -->
                </view>
				<view class="text-content">
					<rich-text :nodes="item.noticeContent"></rich-text>
				</view>

				<view class="text-gray text-sm text-right padding">
                    <!-- <text class="cuIcon-attentionfill margin-lr-xs"></text> -->
                </view>
            </view>
        </view>
    </view>
</template>

<script>
	import storage from '@/utils/storage'
	import {listNotice,getNotice} from '@/api/notice/notice'
	  
    export default {
        data() {
            return {
                isCard: false,
                productList: [{
						username: this.$store.state.user.name,
						createBy: '',
						createTime: '',
						noticeTitle: '',
						noticeContent: '',
						
                    },

                ],
            };
        },
		computed: {
		  avatar() {
		    return this.$store.state.user.avatar
		  },
		},
		created() {
			this.getCode()
		},
        methods: {
			onLoad() {
				// 这里使用了一个示例的富文本内容
				const content = `<p>这是一个富文本内容的示例，<span style="color: red;">支持</span>大部分的HTML标签和样式属性。</p>`
				this.productList.noticeContent = content
			  },
			getCode(){
				listNotice().then(res => {
					console.log(res)
					this.productList = res.rows.map((item) => {
						return {
							createBy: item.createBy,
							createTime: item.createTime,
							noticeTitle: item.noticeTitle,
							noticeContent: item.noticeContent,
							
						};
					});
				})
			},
			handleView(){
				this.$modal.showToast('模块建设中~')
			}
			
		}
    }
</script>
<style>
    .cu-card.dynamic>.cu-item>.text-content {
        margin-bottom: 1px;
        margin-top: 6px;
    }
</style>
